package com.ruoyi.task.service.impl;

import java.util.List;


import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.houseTask.domain.THouseNucleicTask;
import com.ruoyi.houseTask.mapper.THouseNucleicTaskMapper;
import com.ruoyi.household.mapper.THouseholdMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.task.mapper.TBuildingNucleicTaskMapper;
import com.ruoyi.task.domain.TBuildingNucleicTask;
import com.ruoyi.task.service.ITBuildingNucleicTaskService;

/**
 * 楼栋核酸任务Service业务层处理
 *
 * @author ruoyi
 * @date 2022-10-16
 */
@Slf4j
@Service
public class TBuildingNucleicTaskServiceImpl implements ITBuildingNucleicTaskService
{
    @Autowired
    private TBuildingNucleicTaskMapper tBuildingNucleicTaskMapper;
    @Autowired
    private THouseNucleicTaskMapper tHouseNucleicTaskMapper;

    /**
     * 查询楼栋核酸任务
     *
     * @param id 楼栋核酸任务主键
     * @return 楼栋核酸任务
     */
    @Override
    public TBuildingNucleicTask selectTBuildingNucleicTaskById(Long id)
    {
        return tBuildingNucleicTaskMapper.selectTBuildingNucleicTaskById(id);
    }

    /**
     * 查询楼栋核酸任务列表
     *
     * @param tBuildingNucleicTask 楼栋核酸任务
     * @return 楼栋核酸任务
     */
    @Override
    public List<TBuildingNucleicTask> selectTBuildingNucleicTaskList(TBuildingNucleicTask tBuildingNucleicTask)
    {
        return tBuildingNucleicTaskMapper.selectTBuildingNucleicTaskList(tBuildingNucleicTask);
    }

    /**
     * 新增楼栋核酸任务
     *
     * @param tBuildingNucleicTask 楼栋核酸任务
     * @return 结果
     */
    @Override
    public int insertTBuildingNucleicTask(TBuildingNucleicTask tBuildingNucleicTask)
    {
        tBuildingNucleicTask.setCreateTime(DateUtils.getNowDate());

        THouseNucleicTask tHouseNucleicTask = new THouseNucleicTask();
        tHouseNucleicTask.setAddress(tBuildingNucleicTask.getAddress());
        tHouseNucleicTask.setTask(tBuildingNucleicTask.getTask());
        tHouseNucleicTask.setStatus(tBuildingNucleicTask.getStatus().toString());

        tHouseNucleicTaskMapper.insertTHouseNucleicTask(tHouseNucleicTask);
        log.info("新增楼栋核酸任务" + tBuildingNucleicTask);
        return tBuildingNucleicTaskMapper.insertTBuildingNucleicTask(tBuildingNucleicTask);


    }

    /**
     * 修改楼栋核酸任务
     *
     * @param tBuildingNucleicTask 楼栋核酸任务
     * @return 结果
     */
    @Override
    public int updateTBuildingNucleicTask(TBuildingNucleicTask tBuildingNucleicTask)
    {
        return tBuildingNucleicTaskMapper.updateTBuildingNucleicTask(tBuildingNucleicTask);
    }

    /**
     * 批量删除楼栋核酸任务
     *
     * @param ids 需要删除的楼栋核酸任务主键
     * @return 结果
     */
    @Override
    public int deleteTBuildingNucleicTaskByIds(Long[] ids)
    {
        return tBuildingNucleicTaskMapper.deleteTBuildingNucleicTaskByIds(ids);
    }

    /**
     * 删除楼栋核酸任务信息
     *
     * @param id 楼栋核酸任务主键
     * @return 结果
     */
    @Override
    public int deleteTBuildingNucleicTaskById(Long id)
    {
        return tBuildingNucleicTaskMapper.deleteTBuildingNucleicTaskById(id);
    }
}
